#include<iostream>
using namespace std;
void q_sort(int arr[], int n)
{
	int left = 0;
	int right = n - 1;
	while (left <= right)
	{
		while (left <= right && arr[left]%2==1) {
			left++;
		}
		while (left <= right && arr[right]%2==0) {
			right--;
		}
		if (left <= right) {
			swap(arr[left], arr[right]);
		}
	}
}
int main()
{
	int n;
	cin >> n;
	int arr[1500];
	for (int i = 0; i < n; i++) {
		cin >> arr[i];
	}
	q_sort(arr, n);
	for (int i = 0; i < n; i++) {
		cout << arr[i] << " ";
	}

	return 0;
}